/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package controller;

import entities.Device;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.Persistence;
import javax.persistence.Query;

/**
 *
 * @author QUY-THI
 */
public class ListDevices {

    public List<Device> getDevices() {
        EntityManager em = Persistence.createEntityManagerFactory("E-AdministrationPU").createEntityManager();
        Query q = em.createQuery("select d from Device d order by d.deviceID DESC");
        return (List<Device>) q.getResultList();
    }
}
